home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / include / netinet / tcp.h < prev    next >
C/C++ Source or Header  |  1996-04-09  |  3KB  |  97 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  *    @(#)tcp.h    7.4.1.2 (Berkeley) 2/17/89
  18.  */
  19. #ifndef BYTE_ORDER
  20. /*
  21.  * Definitions for byte order,
  22.  * according to byte significance from low address to high.
  23.  */
  24. #define    LITTLE_ENDIAN    1234    /* least-significant byte first (vax) */
  25. #define    BIG_ENDIAN    4321    /* most-significant byte first (IBM, net) */
  26. #define    PDP_ENDIAN    3412    /* LSB first in word, MSW first in long (pdp) */
  27.  
  28. #ifdef vax
  29. #define    BYTE_ORDER    LITTLE_ENDIAN
  30. #else
  31. #define    BYTE_ORDER    BIG_ENDIAN    /* mc68000, tahoe, most others */
  32. #endif
  33. #endif /* BYTE_ORDER */
  34.  
  35. typedef    u_long    tcp_seq;
  36. /*
  37.  * TCP header.
  38.  * Per RFC 793, September, 1981.
  39.  */
  40. #define    TH_FIN    0x01
  41. #define    TH_SYN    0x02
  42. #define    TH_RST    0x04
  43. #define    TH_PUSH    0x08
  44. #define    TH_ACK    0x10
  45. #define    TH_URG    0x20
  46.  
  47. struct tcphdr {
  48.     u_short    th_sport;        /* source port */
  49.     u_short    th_dport;        /* destination port */
  50.     tcp_seq    th_seq;            /* sequence number */
  51.     tcp_seq    th_ack;            /* acknowledgement number */
  52.  
  53. #ifdef LATTICE
  54.     u_int    th_off:4,        /* data offset */
  55.             th_x2:4,        /* reserved */
  56.             th_flags:8,        /* URG, ACK, PSH, RST, SYN, FIN */
  57.             th_win:16;        /* window size */
  58. #elif AZTEC_C
  59.     u_int    th_win:16,        
  60.             th_flags:8,
  61.             th_x2:4,        /* (unused) */
  62.             th_off:4;        /* data offset */
  63. #else    /* Manx 3.6 */    
  64.     short    th_flags:8,
  65.             th_x2:4,        /* (unused) */
  66.             th_off:4;        /* data offset */
  67.     u_short    th_win;            /* window */
  68. #endif
  69.  
  70.     u_short    th_sum;            /* checksum */
  71.     u_short    th_urp;            /* urgent pointer */
  72. };
  73.  
  74. #define    TCPOPT_EOL    0
  75. #define    TCPOPT_NOP    1
  76. #define    TCPOPT_MAXSEG    2
  77.  
  78. /*
  79.  * Default maximum segment size for TCP.
  80.  * With an IP MSS of 576, this is 536,
  81.  * but 512 is probably more convenient.
  82.  */
  83. #ifdef    lint
  84. #define    TCP_MSS    536
  85. #else
  86. #ifndef IP_MSS
  87. #define    IP_MSS    576
  88. #endif
  89. #define    TCP_MSS    MIN(512, IP_MSS - sizeof (struct tcpiphdr))
  90. #endif
  91.  
  92. /*
  93.  * User-settable options (used with setsockopt).
  94.  */
  95. #define    TCP_NODELAY    0x01    /* don't delay send to coalesce packets */
  96. #define    TCP_MAXSEG    0x02    /* set maximum segment size */
  97.